home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
2207
/
2207.xpi
/
chrome
/
cooliris.jar
/
content
/
cooliris
/
coolirisStats.js
< prev
next >
Wrap
Text File
|
2010-01-28
|
4KB
|
113 lines
var cpvw_objStats={isCheckedTimer:false,statsUrl:"http://hf.cooliris.com/hellfire/log",logData:"",generateGUID:function(){
var _1=Components.classes["@mozilla.org/uuid-generator;1"].getService(Components.interfaces.nsIUUIDGenerator);
var _2=_1.generateUUID().toString();
_2=_2.replace(/{|}/gi,"");
return _2.toString();
},setInitPreferences:function(){
cpvw_prefHandler.setPrefIfNotExists(cpvw_Prefs.prefGUID,cpvw_objStats.generateGUID());
cpvw_prefHandler.setPrefIfNotExists(cpvw_Prefs.prefTimestamp,Math.round((new Date()).valueOf()/1000));
cpvw_prefHandler.setPrefIfNotExists(cpvw_Prefs.prefCount,0);
},makeClientInfo:function(){
var _3=parseInt(cpvw_prefHandler.getPref(cpvw_Prefs.prefInstallTS),10);
if(_3>1000000000000){
_3=Math.round(_3/1000);
}
var _4=parseInt(cpvw_prefHandler.getPref(cpvw_Prefs.prefLastUpdateTS),10);
if(_4>1000000000000){
_4=Math.round(_4/1000);
}
var _5="client_info { "+"instance_id: \"{0}\" "+"user_name: \"{1}\" "+"client_os: {2} "+"client_browser: kBrowserFirefox "+"client_browser_version: \"{3}\" "+"client_version: \"{4}\" "+"config_cookie: \"Previews\" "+"product: kProductCoolPreviews "+"install_timestamp: {5}000 "+"last_update_timestamp: {6}000 "+"} ";
var _6=Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
return cpvw_jsUtils.stringFormat(_5,cpvw_prefHandler.getPref(cpvw_Prefs.prefGUID),cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewUserEmail),this.getOS(),_6.version,this.getAddonVersion(true),_3,_4);
},getAddonVersion:function(_7){
var em=Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
var _9=em.getItemForID("{CE6E6E3B-84DD-4cac-9F63-8D2AE4F30A4B}");
var _a=_9.version;
if(_a.length==3){
_a+=".0.0000";
}else{
if(_a.length==5){
_a+=".0000";
}
}
return _7?_a:_9.version;
},getOS:function(){
var _b=Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
switch(_b){
case "WINNT":
return "kSystemWindows";
case "Linux":
return "kSystemLinux";
case "Darwin":
return "kSystemMac";
}
return "kSystemOther";
},sendInstallEvent:function(_c){
var _d;
var _e="";
switch(_c){
case "install":
_d="kFreshInstall";
break;
case "update":
_d="kUpdateInstall";
break;
case "uninstall":
_d="kUninstall";
_e=this.sendAdId();
break;
}
var _f=" install_event { "+"install_mode: "+_d+" "+"}";
var _10=this.makeClientInfo()+_f+_e;
this.sendData(_10);
},sendAdId:function(){
var _11=cpvw_prefHandler.getPref(cpvw_Prefs.prefAdId);
var _12=" previews_ad_id_event { user_ad_id: "+_11+" } ";
return _12;
},sendPreviewsLifeTimeEvents:function(_13,_14){
var _15=" previews_lifetime_events { "+"num_previews: {0}"+" num_stacks: {1}"+"}";
_15=cpvw_jsUtils.stringFormat(_15,_13,_14);
this.logData+=_15;
},sendLaunchEvents:function(_16,_17){
var _18=" launch_events { "+"timestamp: {0} "+"page_uri: \"{1}\" "+"}";
_18=cpvw_jsUtils.stringFormat(_18,_16,_17);
this.logData+=_18;
},sendCloseEvents:function(_19,_1a){
var _1b=" close_events { "+"timestamp: {0} "+" session_duration_milliseconds: {1} "+"}";
_1b=cpvw_jsUtils.stringFormat(_1b,(new Date()).getTime(),(_1a-_19));
this.logData+=_1b;
},sendMessageEvents:function(_1c){
var _1d=" send_message_events { "+"timestamp: {0} "+" num_recipients: {1} "+"}";
_1d=cpvw_jsUtils.stringFormat(_1d,(new Date()).getTime(),_1c);
this.logData+=_1d;
},sendBufferData:function(){
var _1e=this.makeClientInfo()+this.sendAdId()+this.logData;
this.sendData(_1e);
cpvw_previewHandler.stackCount=0;
},sendButtonClickEvents:function(_1f){
var _20=" button_click_events { "+"timestamp: "+(new Date()).getTime()+" "+"name: \""+_1f+"\" "+"} ";
this.logData+=_20;
},checkIfInactiveUser:function(){
var _21=Math.round((new Date()).getTime()/1000);
var _22=parseInt(cpvw_prefHandler.getPref(cpvw_Prefs.prefTimestamp));
var _23=86400;
if(_21-_22>_23){
var _24=this.makeClientInfo()+this.sendAdId();
this.sendData(_24);
}
},sendData:function(_25){
cpvw_prefHandler.setPref(cpvw_Prefs.prefTimestamp,Math.round((new Date()).getTime()/1000));
var _26=new cpvw_httpClient(this);
this.logData="";
_26.doRequest("POST",this.statsUrl,"",_25,false,[{name:"Content-Type",value:"text/plain"}],function(_27){
});
},checkBufferAndSend:function(){
if(this.logData!=""){
this.sendBufferData();
}
}};
function cpvw_dump(_28){
dump("\n"+_28);
}